//引入接口：
import {menulist} from '../../../request/api'
const state = {
    menulist: []
}
const mutations = {
    REQ_LIST(state,payload){
        state.menulist = payload
    }
}
const actions = {
    getMenuActions({commit}) {
        menulist()
            .then(res => {
                console.log(res, '菜单列表')
                if(res.code==200){
                    commit('REQ_LIST',res.list?res.list : [])
                }
            })
    }
}
const getters = {
    getMenu(state) {
        return state.menulist
    }
}

export default {
    state,
    mutations,
    actions,
    getters,
    //开启命名空间
    namespaced: true
}